package ac.beiwo.baas.common.entity;

/**
 * Created by Staryet on 15/8/24.
 */
public enum SimpleCode {

    INTENAL_ERROR(500, "服务器内部错误"),
    AUTH_LESS(10, "缺少授权信息"),
    AUTH_TIME_OUT(11, "授权信息信息失效"),
    AUTH_ERROR(12, "授权信息验证失败"),
    AUTH_NEED_MASTER_SIGN(13, "缺少管理权限"),
    REQUEST_PARAM_ERROR(2, "传入参数错误"),
    CLAZZ_NOT_FOUND(101, "类不存在"),
    CLAZZ_ALREADY_EXIST(102, "类已经存在"),
    CLAZZ_NAME_ERROR(103, "类名称错误"),
    CLAZZ_INTERNAL(104, "内建类禁止删除"),
    FIELD_NOT_FOUND(111, "字段不存在"),
    FIELD_ALREADY_EXIST(112, "字段已存在"),
    FIELD_NAME_MISSING(113, "字段名缺失"),
    FIELD_NAME_ERROR(114, "字段名禁止使用"),
    FIELD_INTERNAL(115, "内建字段禁止删除"),
    USER_NOT_EXIST(121, "用户不存在"),
    USER_EMPTY_PASSWORD(122, "密码不能为空"),
    USER_WRONG_PASSWORD(123, "密码错误"),
    USER_ALREADY_EXIST(124, "密码错误"),
    USER_NOT_MATCH(125, "用户不匹配禁止修改信息"),
    OBJECT_FIELD_TYPE_ERROR(1001, "字段类型错误"),
    OBJECT_INCLUDE_ERROR(1002, "包含字段格式错误"),
    OBJECT_ORDER_ERROR(1003, "排序字段格式错误"),
    OBJECT_ID_ERROR(1004, "id格式错误"),
    OBJECT_NOT_EXIST(1005, "对象不存在"),
    OBJECT_NO_ACCESS(1006, "无操作权限"),
    OBJECT_CLAZZ_NO_ACCESS(1007, "无表级权限"),
    FILE_NO_HANDLER(2001, "无对应的物理文件处理器"),
    FILE_CALLBACK_NO_VALID(2002, "回调授权失败");

    private int code;
    private String message;

    SimpleCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public String toString() {
        return message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
